Skip to content

chore: Upgrade Avalonia to 12.0 and migrate codebase#1673

Draft
yuto-trd wants to merge 25 commits into
mainfrom
yuto-trd/migrate-avalonia-12
Draft

chore: Upgrade Avalonia to 12.0 and migrate codebase#1673
yuto-trd wants to merge 25 commits into
mainfrom
yuto-trd/migrate-avalonia-12

Conversation

@yuto-trd
Copy link
Copy Markdown
Member

Description

  • Upgrade Avalonia from 11.x to 12.0 and update related dependencies across the solution (Directory.Packages.props, csproj files).
  • Migrate codebase to Avalonia 12 APIs: ReflectionBinding for dynamic bindings, x:DataType for compiled bindings, PlaceholderText, FocusChangedEventArgs, Math.Clamp, Avalonia.Input.Platform namespace, logical-tree traversal, and TopLevel-based scaling.
  • Replace Avalonia.Diagnostics with AvaloniaUI.DiagnosticsSupport (WithDeveloperTools()), remove the custom BcTabItem/BcTabView/DirectoryTreeView controls, and migrate UI to FluentAvalonia (FA) components including the renamed Beutl.FluentIcons.FluentAvalonia package.
  • Drop the obsolete DirectoryViewTest project and adjust several window/editor views (styles, drag handling, IListEditorViewModel.IsEnabled, etc.) for consistency under the new framework.

Breaking changes

  • Extensions depending on the custom BcTabItem/BcTabView or DirectoryTreeView controls must migrate to the FluentAvalonia equivalents, since these controls were removed.
  • Extensions referencing the FluentIcons.FluentAvalonia package must switch to Beutl.FluentIcons.FluentAvalonia.
  • Targeting Avalonia 12 means extensions must be recompiled against the new Avalonia 12 API surface.

Fixed issues

None

@github-actions
Copy link
Copy Markdown
Contributor

Code Coverage

Package Line Rate Branch Rate Complexity Health
Beutl.ProjectSystem 17% 10% 926
Beutl.Utilities 73% 67% 358
Beutl.Language 1% 50% 1148
Beutl.Configuration 40% 20% 314
Beutl.Threading 100% 93% 122
Beutl.NodeGraph 6% 2% 2490
Beutl.Core 39% 35% 3070
Beutl.Engine 20% 18% 16812
Beutl.Extensibility 11% 14% 111
Beutl.Editor 70% 65% 1011
Summary 23% (14513 / 62203) 22% (4086 / 18627) 26362

Minimum allowed line rate is 0%

@yuto-trd yuto-trd force-pushed the yuto-trd/migrate-avalonia-12 branch 2 times, most recently from 49ae40e to c71c40c Compare April 27, 2026 08:19
yuto-trd added 22 commits June 6, 2026 22:09
…base

main側で追加された新規コードがリベース後も移行前のAPIを参照していたため修正:
- FluentAvalonia 3.0 のFA接頭辞付き型へ移行
  (ContentDialog/IconSource/PickerFlyoutBase/SymbolIcon 等 -> FA*)
- Avalonia 12 で非公開化した Visual.GetVisualRoot() を
  IsAttachedToVisualTree() へ置換

対象: WindowCaptureDialog, CrashRecoveryPromptTask, ToolWindowExtension,
ExtensionsToolWindowExtension, OutputPickerFlyoutPresenter, HistoryView,
MarkerEditFlyout, OutputPickerFlyout, OutputTab, MainView,
CommandPaletteView, SampleToolWindowExtension
@yuto-trd yuto-trd force-pushed the yuto-trd/migrate-avalonia-12 branch from c71c40c to ac43186 Compare June 6, 2026 15:55
// needs to know the exact types at compile time.

[DllImport("/usr/lib/libobjc.A.dylib")]
private static extern IntPtr objc_getClass(string name);
private static extern IntPtr objc_getClass(string name);

[DllImport("/usr/lib/libobjc.A.dylib")]
private static extern IntPtr sel_registerName(string name);
private static extern IntPtr sel_registerName(string name);

[DllImport("/usr/lib/libobjc.A.dylib", EntryPoint = "objc_msgSend")]
private static extern IntPtr objc_msgSend_ret(IntPtr receiver, IntPtr selector);
private static extern IntPtr objc_msgSend_ret(IntPtr receiver, IntPtr selector);

[DllImport("/usr/lib/libobjc.A.dylib", EntryPoint = "objc_msgSend")]
private static extern void objc_msgSend_arg(IntPtr receiver, IntPtr selector, IntPtr arg);
private static extern void objc_msgSend_arg(IntPtr receiver, IntPtr selector, IntPtr arg);

[DllImport("/usr/lib/libobjc.A.dylib", EntryPoint = "objc_msgSend")]
private static extern IntPtr objc_msgSend_arg_ret(IntPtr receiver, IntPtr selector, IntPtr arg);
private static extern IntPtr objc_msgSend_arg_ret(IntPtr receiver, IntPtr selector, IntPtr arg);

[DllImport("/usr/lib/libobjc.A.dylib", EntryPoint = "objc_msgSend")]
private static extern void objc_msgSend_bool(IntPtr receiver, IntPtr selector, [MarshalAs(UnmanagedType.I1)] bool arg);
private static extern void objc_msgSend_bool(IntPtr receiver, IntPtr selector, [MarshalAs(UnmanagedType.I1)] bool arg);

[DllImport("/usr/lib/libobjc.A.dylib", EntryPoint = "objc_msgSend")]
private static extern void objc_msgSend_long(IntPtr receiver, IntPtr selector, long arg);

// remove the toolbar to restore the default thin title bar
if (_nsWindow != IntPtr.Zero && _selSetToolbar != IntPtr.Zero)
objc_msgSend_arg(_nsWindow, _selSetToolbar, IntPtr.Zero);

// 2. cache ObjC selectors used during setup and fullscreen transitions.
// sel_registerName returns a stable pointer for the lifetime of the process.
_selSetToolbar = sel_registerName("setToolbar:");
// 2. cache ObjC selectors used during setup and fullscreen transitions.
// sel_registerName returns a stable pointer for the lifetime of the process.
_selSetToolbar = sel_registerName("setToolbar:");
_selSetTitlebarAppearsTransparent = sel_registerName("setTitlebarAppearsTransparent:");
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 6, 2026

No TODO comments were found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant